/**************************************************************************************
*
*	Copyright (C) 2009 Brent Andrew Chua - See LICENSE.txt for more info.
*		
*	Filename	-	BitmapAlpha.h
*
*	Description -	Bitmap that supports transparency.
*
*	Comments	-	If you don't understand some part of the code, use MSDN!!!
*						Move the cursor to the function/type then hit F1 in VS.
*
*					RGB( 255, 0, 255 ) - Is Magenta. uh... pink?
*
*	Modification History:
*			Name			   Date					Description
*			CodeSushi	-	11/18/2009	-	Creation of this file
**************************************************************************************/

#ifndef _BITMAP_TRANSPARENCY_H_
#define _BITMAP_TRANSPARENCY_H_

#include "BitmapMasked.h"

class BitmapAlpha : public BitmapMasked
{
public:

	BitmapAlpha( HINSTANCE hAppInst, const CHAR *pImageFileName, const BYTE alpha = 255, HDC spriteDC = NULL, const UINT colorKey = RGB( 255, 0, 255 ) , const PositionType posType = POS_UPPER_LEFT, const BlendOptions bOp = BLEND_SRC_COPY );
	virtual ~BitmapAlpha( void );

	void SetAlpha( const BYTE alpha );
	BYTE GetAlpha( void ) const;

	void Render( HDC hBBDC, HDC hSprDC, INT x, INT y );
	virtual void Render( HDC hBBDC, HDC hSprDC, INT x, INT y, INT w, INT h, INT srcX, INT srcY );
	//virtual void Render( HDC hBBDC, HDC hSprDC, RECT dest, INT srcX, INT srcY ); // Should be the same as Bitmap

private:

	BLENDFUNCTION m_bFunc;
	FLOAT m_alpha;

};

PSX_INLINE void BitmapAlpha::SetAlpha( const BYTE alpha )
{
	m_bFunc.SourceConstantAlpha = alpha;
	m_alpha = alpha;
}

PSX_INLINE BYTE BitmapAlpha::GetAlpha( void ) const
{
	return m_bFunc.SourceConstantAlpha;
}

PSX_INLINE BitmapAlpha::~BitmapAlpha( void )
{
	DeleteObject( m_hBitmap );
}


#endif /* _BITMAP_TRANSPARENCY_H_ */